<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Mobile_Article_module extends CI_Module
{
    public $data;
    public $sid ;

    public function __construct()
    {
        parent::__construct();
        $this->sid = $GLOBALS['sid'];
        $this->data = $GLOBALS['config'];
        $this->load->model('article.Article_model');
        $this->load->model('article.Articlecat_model');
    }

    public function index()
    {
        $this->data['datalist'] = $this->Article_model->get_help_list();
        $this->data['common'] = array(
            array(
                'head'   => '帮助中心',
                'title'   => ''.SITECITYNAME.'旅游网_'.SITECITYNAME.'旅游攻略_'.SITECITYNAME.'市旅游局',
                'keywords'   => ''.SITECITYNAME.'旅游网,'.SITECITYNAME.'市旅游局,'.SITECITYNAME.'市旅游局',
                'description'   => ''.SITECITYNAME.'旅游网-'.SITECITYNAME.'旅游局主办，为您提供'.SITECITYNAME.'旅游资讯、'.SITECITYNAME.'旅游攻略、'.SITECITYNAME.'旅游线路，包括'.SITECITYNAME.'热门景点介绍、精彩游记、旅游地图、交通出行、游玩路线、旅游优惠信息、住宿、饮食、购物等旅游信息的综合性旅游门户网站。'
            )
        );
        $this->load->view(MOBILE_TEMPLATE_NAME.'/'.'article', $this->data);
    }

    public function profile()
    {
        $id = intval($_GET['id']);
        $where = array('article_id'=>$id);
        $this->data['info'] = $this->Article_model->get_row($where);
        $content = strip_tags($this->data['info']['content'], '<img><a><p>');
        $patterns[0] = '/style=".*?"/i';
        $patterns[1] = '/height=".*?"/i';
        $replacements[2] = " ";
        $replacements[1] = " ";
        $this->data['info']['content'] = preg_replace($patterns,$replacements, $content);
        $this->data['common'] = array(
            array(
                'head'   => '帮助详细',
                'title'   => ''.SITECITYNAME.'旅游网_'.SITECITYNAME.'旅游攻略_'.SITECITYNAME.'市旅游局',
                'keywords'   => ''.SITECITYNAME.'旅游网,'.SITECITYNAME.'市旅游局,'.SITECITYNAME.'市旅游局',
                'description'   => ''.SITECITYNAME.'旅游网-'.SITECITYNAME.'旅游局主办，为您提供'.SITECITYNAME.'旅游资讯、'.SITECITYNAME.'旅游攻略、'.SITECITYNAME.'旅游线路，包括'.SITECITYNAME.'热门景点介绍、精彩游记、旅游地图、交通出行、游玩路线、旅游优惠信息、住宿、饮食、购物等旅游信息的综合性旅游门户网站。'
            )
        );
        $this->load->view(MOBILE_TEMPLATE_NAME.'/'.'article_profile',$this->data);
    }
}